package com.lwj.securitydemo.web.filter;


import javax.servlet.*;
import java.io.IOException;
import java.util.Date;

public class TimeFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("TimeFilter init");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("TimeFilter doFilter");
        System.out.println("start do something..." + new Date());
        filterChain.doFilter(servletRequest, servletResponse);
        System.out.println("something is done" + new Date());
    }

    @Override
    public void destroy() {
        System.out.println("TimeFilter destroy");
    }
}
